package com.ytktt.study.week8.task6.hmily.tcc.stock.api;

import com.ytktt.study.week8.task6.hmily.tcc.stock.dto.ItemStockDTO;
import org.dromara.hmily.annotation.Hmily;

/**
 * TODO
 *
 * @author ytk
 */
public interface ItemStockService {

    /**
     * 扣减库存操作
     * 这一个tcc接口
     *
     * @param itemStockDTO 库存DTO对象
     * @return true boolean
     */
    @Hmily
    Boolean decrease(ItemStockDTO itemStockDTO);

    /**
     * Test decrease boolean.
     *
     * @param itemStockDTO the inventory dto
     * @return the boolean
     */
    Boolean testDecrease(ItemStockDTO itemStockDTO);

    /**
     * mock扣减库存异常
     *
     * @param itemStockDTO dto对象
     * @return String string
     */
    @Hmily
    String mockWithTryException(ItemStockDTO itemStockDTO);

    /**
     * mock扣减库存超时
     *
     * @param itemStockDTO dto对象
     * @return String boolean
     */
    @Hmily
    Boolean mockWithTryTimeout(ItemStockDTO itemStockDTO);

    /**
     * mock 扣减库存confirm超时
     *
     * @param itemStockDTO dto对象
     * @return True boolean
     */
    @Hmily
    Boolean mockWithConfirmTimeout(ItemStockDTO itemStockDTO);
}
